







<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so search-form">
            <input class="layui-input"  autocomplete="off" placeholder="开始日" name="date1"  value="{:input('date1')}" id="start">
            <input class="layui-input"  autocomplete="off" placeholder="截止日" name="date2"  value="{:input('date2')}" id="end">
            <input type="text" name="search_data"  placeholder="用户名|店铺名|UID" autocomplete="off" value="{:input('search_data')}"  class="layui-input">
            <div class="layui-input-inline">
                <select name="wallet_id">
                    <option value="" >全部币种</option>
                    {volist name='wallet' id='vo'}
                    <option value="{$vo['id']}" {notempty name="param['wallet_id']"}{if condition="$param['wallet_id'] eq $vo['id']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                    {/volist}
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="state">
                    <option value="" >全部</option>

                    <option value="1" {notempty name="param['state']"}{if condition="$param['state'] eq 1"} selected="selected" {/if}{/notempty} >待发放</option>
                    <option value="2" {notempty name="param['state']"}{if condition="$param['state'] eq 2"} selected="selected" {/if}{/notempty} >已发放</option>

                </select>
            </div>
            <button class="layui-btn"  id="search"  url="{:url('shop_list')}"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>

        </form>
    </div>
    <xblock>
        <button class="layui-btn layui-btn-danger" onclick="setCompany()"><i class="layui-icon"></i>批量发放</button>
        <span class="x-right" style="line-height:40px;margin-right:10px;">共有数据：{$list.count} 条</span>
    </xblock>
    <hr/>

    <table class="layui-table x-admin">
        <thead>
        <tr>
            <th>
                序号
            </th>
            <th>会员基础信息</th>
            <th>店铺信息</th>
            <th>补贴信息</th>
            <th>补贴状态</th>
            <th>补贴信息</th>
            <th>操作</th>
        </thead>
        {notempty name='list.list'}
        <tbody>
        {volist name='list.list' id='vo' key="k"}
        <tr>
            <td >
                {$k}
            </td>
            <td >
                <div><label>用户名:</label><span>{$vo.username}{if condition ="$vo.is_company eq 1"}<span style="color: #f56c6c">(公司账户)</span>{/if}</span></div>
                <div>  <label>手机:</label><span>{$vo.mobile|default='未绑定'}</span></div>
                <div> <label>推荐人:</label><span>{$vo.user.leader_nickname}</span></div>
                <div> <label>注册时间:</label><span>{$vo.reg_time|date='Y-m-d H:i:s',###}</span></div>
            </td>

            <td >
                <div><label>店铺名:</label><span>{$vo.shop_name}</span></div>
                <div>  <label>收款方式:</label><span>{$vo.shop.pay_array}</span></div>
                <div> <label>币种:</label><span>{$vo.wallet.name}</span></div>
                <div> <label>币种价格:</label><span>{$vo.price}</span></div>
            </td>
            <td >
                <div><label>完成阶段名称:</label><span>{$vo.allocation.name}</span></div>
                <div>  <label>代发金额:</label><span>{$vo.allocation.substitute_money}</span></div>
                <div> <label>代发订单数:</label><span>{$vo.allocation.substitute_count}</span></div>
                <div><label>代收金额:</label><span>{$vo.allocation.collection_money}</span></div>
                <div>  <label>代收订单数:</label><span>{$vo.allocation.collection_count}</span></div>
                <div> <label>允许投诉:</label><span>{$vo.allocation.feed_count}单</span></div>
            </td>
            <td >
                <div><label>补贴状态:</label><span>{$vo.state_text}</span></div>
                <div>  <label>所需补贴金额:</label><span>{$vo.total}</span></div>
                <div>  <label>所需补贴币种数量:</label><span>{$vo.coin_number}</span></div>
            </td>

            <td >
                <div><label>完成阶段时间:</label><span>{$vo.create_time}</span></div>
                <div>  <label>补贴发放时间:</label><span> {if condition="$vo['state'] eq 2"}{$vo.update_time|date='Y-m-d H:i:s', ###}{/if}</span></div>

            </td>
            <td class="td-manage">

                {if condition="$vo['state'] eq 1"}
               <ob_link><a class="ajax-get layui-btn layui-btn-normal layui-btn-mini" href="{:url('update_info', array('ids' => $vo['id'], 'state' =>2))}">  发放</a></ob_link>
                {/if}


            </td>
        </tr>
        {/volist}
        {else/}
        <tbody><tr class="odd"><td colspan="12"  valign="top">{:config('empty_list_describe')}</td></tr></tbody>
        {/notempty}

        </tbody>
    </table>
    <div class="page">
        {notempty name='list.list'}   {$list.list->render()}{/notempty}
    </div>

</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        layer=layui.layer;
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });




    function setCompany () {

        var data = tableCheck.getData();
        if(data.length==0){
            layer.msg('请选择会员');
            return
        }

        layer.confirm('确认发放', function (index) {
            //捉到所有被选中的，发异步进行删除
            //监听提交
            var url = "{:url('update_info')}";

            $.post(url, {ids: data}, function (d) {
                if (d.code == 1) {

                    window.location.reload();

                } else {
                    layer.msg(d.msg);

                }
            }, 'json');


        });
    }



    //导出功能
    $(".export").click(function(){

        window.location.href = searchFormUrl($(".export"));
    });
</script>

</body>

</html>




